﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExceptionReporting;
using Habanero.Base;

namespace FireStarterModeller
{
    public class ExceptionReporterNotifier : IExceptionNotifier
    {
        private ExceptionReporter _exceptionReporter;
        private string _exceptionMessage;

        public ExceptionReporterNotifier()
        {
            _exceptionReporter = new ExceptionReporter();
            _exceptionReporter.ReadConfig();
            _exceptionReporter.Config.AppName = GlobalRegistry.ApplicationName;
            _exceptionReporter.Config.AppVersion = GlobalRegistry.ApplicationVersion;
            _exceptionReporter.Config.AppAssembly = this.GetType().Assembly;
            _exceptionReporter.Config.TakeScreenshot = true;
            _exceptionReporter.Config.ShowFullDetail = false;
            _exceptionReporter.Config.ShowLessMoreDetailButton = true;
        }

        public void Notify(Exception ex, string furtherMessage, string title)
        {
            _exceptionMessage = ex.Message;
            _exceptionReporter.Show(furtherMessage + " " + ex.Message, ex);
        }

        public string ExceptionMessage
        {
            get
            {
                return _exceptionMessage;
            }
        }
    }
}
